package com.quanxi.qxaimain.service.indicatorsService;

import com.quanxi.qxaimain.model.indicators.Pargram;
import com.quanxi.qxaimain.model.indicators.indicatorsGet;
import com.quanxi.qxaimain.model.indicators.responseIndicators;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 * @Author lyx
 * @create 2022/9/7 17:50
 */
@Slf4j
@Service("indicatorsAsynService")
public class indicatorsAsynServiceImpl implements indicatorsAsynService {
    @Override
    @Async("taskExecutor")
    public Future<responseIndicators> get(String ind_id , String ind_name , String sql, indicatorsGet indicatorsGet, Pargram pargram) throws ExecutionException, InterruptedException {
        log.info("Thread Name： "+Thread.currentThread().getName()+"  sql编号:"+ind_id+" "+ind_name);

        responseIndicators responseIndicators = new responseIndicators(ind_id,ind_name,sql,indicatorsGet,pargram);

        return new AsyncResult<>(responseIndicators);
    }
}